import { createRouter, createWebHashHistory } from "vue-router";

const routes = [
  {
    path: "/",
    component: () => import("@/views/layout/"),
    redirect: "home",
    children: [
      {
        path: "/home", //首页是默认子路由，所谓为空
        name: "home",
        component: () => import("@/views/home"),
      },
      {
        path: "/classify",
        name: "classify",
        component: () => import("@/views/classify"),
      },

      {
        path: "/shopCart",
        name: "shopCart",
        component: () => import("@/views/shopCart"),
      },
      {
        path: "/mine",
        name: "mine",
        component: () => import("@/views/mine"),
      },
    ],
  },
  {
    path: "/recommend",
    name: "recommend",
    component: () => import("@/views/recommend"),
  },
  {
    path: "/search",
    name: "search",
    component: () => import("@/views/search"),
  },
];

const router = createRouter({
  history: createWebHashHistory(),
  routes,
});

export default router;
